/**
 * @author wangxiaowei
 * 组织部发文列表
 */
var sort = null;
var grid = null;
window.onresize = function(){ 
		if(grid !=null)
		{
	        grid.setHeight(0); 
	        grid.setHeight($(window).height()-7); 
		}
	     
};
function initgenzonglist(){
initselectuserradio();	
var colModel = new Ext.grid.ColumnModel([
		{header:'姓名',dataIndex:'username',menuDisabled : true},
		{header:'环节名称',dataIndex:'taskname',menuDisabled : true},
		{header:'完成时间',dataIndex:'time',menuDisabled : true},
		{header:'操作',dataIndex:'operate',menuDisabled : true}
	]);
	var url = Ext.get('url').getValue();
	sort = new Ext.data.JsonStore({
		url:url,
		autoLoad:true,
		fields:['username','taskname','time','operate']
	});
	 grid = new Ext.grid.GridPanel({
		title:'行政收文跟踪列表',
		cm:colModel,
		tbar:[{
			 text: '返回',
             iconCls: 'silk-add',
              handler:function(){
             	window.location.href=Ext.get('historyurl').getValue();
             }
		}],	
		renderTo:'topic-grid',
		store:sort,
		loadMask:true,
		height:$(window).height()-17,
		viewConfig:{
			forceFit:true
		}
	});
}
/**
 * 改变流程候选人
 * @param {} taskid
 */
function changActor(taskid){
	var url = Ext.get('changActorurl').getValue();
					Ext.Ajax.request({
						url:url,
						params:{
							taskid:taskid,
							actorid:Ext.get('userid').getValue()
						},
						success:function(response, options){
							    var responseArray = Ext.util.JSON.decode(response.responseText);                                              
			                     if(responseArray.success==true){
			                        Ext.Msg.alert('信息','操作成功！',function(){
			                        	sort.reload({callback :function(){
			                        		grid.getView().refresh();	
			                        	}});										
			                        });			                     
			                     }
			                    else{
			                    	Ext.Msg.alert('信息','操作失败！');     
			                    } 
						}
					});
	
}

/**
 * 结束任务
 * @param {} taskid
 */
function endTask(taskid){
	Ext.MessageBox.show({
			           title:'消息',
			           msg: '是否执行此操作?',
			           buttons: Ext.MessageBox.YESNO,
			           fn: function(btn){
			           	  if(btn == 'yes'){
			           		var url = Ext.get('endTaskurl').getValue();
							Ext.Ajax.request({
								url:url,
								params:{
									taskid:taskid
								},
								success:function(response, options){
									    var responseArray = Ext.util.JSON.decode(response.responseText);                                              
					                     if(responseArray.success==true){
					                        Ext.Msg.alert('信息','操作成功！',function(){
					                        	sort.reload({callback :function(){
					                        		grid.getView().refresh();	
					                        	}});										
					                        });			                     
					                     }
					                    else{
					                    	Ext.Msg.alert('信息','操作失败！');     
					                    } 
								}
							});
			           	  }	
			           },
			           icon: Ext.MessageBox.QUESTION
       });
}
	
	